package Thread.Test.Test5;

import java.util.Collections;

public class award_p2 extends Thread{
    @Override
    public void run() {
        while (true) {

            synchronized (jackpot_p.lock) {
                if (jackpot_p.list.isEmpty()) {
                    break;
                }
                //打乱集合的数据
                Collections.shuffle(jackpot_p.list);
                int award = jackpot_p.list.get(0);
                jackpot_p.list.remove(0);
                System.out.println(getName() + "又产生了一个" + award + "元的大奖");
                try {
                    sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        }

    }
}
